﻿@model mesoBoard.Framework.Models.ViewForumViewModel

@{
    Layout = "~/Views/Shared/_Site.cshtml";
}

@section BreadCrumbContent {

    @Html.ActionLink("Board Index", "Index", "Board")    
    &raquo;
    @Html.ActionLink(Model.Forum.Category.Name, "Index", "Board")    
    &raquo;
    @Html.ActionLink(Model.Forum.Name, "ViewForum", "Board", new { ForumID = Model.Forum.ForumID }, new { @class = "current" })        

}

<div class="view_forum">    
        
    <div class="header">

        <div class="create">
            @Html.ActionLink("Create Thread", "CreateThread", "Post", new { ForumID = Model.Forum.ForumID }, new { @class = "create_thread link_button" })
        </div>
            
        @if(Model.Pagination.TotalPages != 1) {
            <div class="_Pagination">
                    @Html.Partial("_Pagination", Model.Pagination) 
            </div>
            } 

        <div class="details">
            <div class="title">
                Forum: 
                @Html.ActionLink(Model.Forum.Name, "ViewForum", "Board", new { ForumID = Model.Forum.ForumID }, null) 
            </div>

            <div class="actions">
                    
            </div>   
        </div>         

    </div>

    <div class="threads">
        @if(Model.GlobalAnnouncements.Count > 0 ) {  
            <table>
                <tr class="header">
                    <th colspan="2">Global Announcements</th>
                    <th class="last_post">Last Post</th>
                    <th class="stats">Posts</th>
                    <th class="stats">Views</th>
                </tr>

                @foreach (var threadRow in Model.GlobalAnnouncements){
                        @Html.Partial("_ThreadRow", threadRow) 
                }

            </table>
        } 

        <table>
            <tr class="header">
                <th colspan="2">Threads</th>
                <th class="last_post">Last Post</th>
                <th class="stats">Posts</th>
                <th class="stats">Views</th>
            </tr>

            @if(Model.ThreadRows.Count == 0){
            <tr>
                <td colspan="5" class="empty">No Threads</td>
            </tr>
            }

            @foreach(var threadRow in Model.ThreadRows){
                    @Html.Partial("_ThreadRow", threadRow) 
            }

        </table>
    </div>

    <div class="footer">
        <div class="details">
            <div class="title">
                Forum: 
                @Html.ActionLink(Model.Forum.Name, "ViewForum", "Board", new { ForumID = Model.Forum.ForumID }, null) 
            </div>

            <div class="actions">
                <!-- TODO: Add "Mark forum as read" -->
            </div>   
        </div>  

        <div class="create">
            @Html.ActionLink("Create Thread", "CreateThread", "Post", new { ForumID = Model.Forum.ForumID }, new { @class = "create_thread link_button" })
        </div>
            
        @if(Model.Pagination.TotalPages != 1) {
            <div class="_Pagination">
                    @Html.Partial("_Pagination", Model.Pagination) 
            </div>
        } 


        <div style="clear:both">&nbsp;</div>


            @Html.Partial("_ForumPermissions", Model.UserPermissions) 

        <table class="thread_types">
            <tr><td>@Html.ThemeImage("thread_new_normal.png") </td><td>Thread</td></tr>
            <tr><td>@Html.ThemeImage("thread_new_sticky.png")</td><td>Sticky</td></tr>
            <tr><td>@Html.ThemeImage("thread_new_announcement.png")</td><td>Announcement</td></tr>
        </table>
    </div>
</div>

